package com.itheima.api_date.regex;

import java.util.Scanner;

/**
 * @author Anomaly
 * @date 2022/12/30 16:25
 */
public class RegexDemo2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            checkEmail(scanner);
        }

    }

    public static void checkPhone(Scanner scanner) {
        String next = scanner.next();
        if (next.matches("1[3-9]\\d{9}")) {
            System.out.println("匹配成功");
        } else {
            System.err.println("匹配失败");
        }
    }

    public static void checkEmail(Scanner scanner) {
        String next = scanner.next();
        if (next.matches("\\w{1,30}@[a-z0-9A-Z]{2,20}(\\.[a-z0-9A-Z]{2,20}){1,5}")) {
            System.out.println("匹配成功");
        } else {
            System.err.println("匹配失败");
        }
    }
}
